//
//  EARectMealController.m
//  WhatToEat
//
//  Created by 方力 on 15/8/1.
//  Copyright (c) 2015年 Mac. All rights reserved.
//

#import "EARectMealController.h"
#import "EACollectionViewCell.h"
#import "EARoundMealController.h"
@interface EARectMealController ()
@property(strong,nonatomic)UICollectionView * collectionView;
@end

@implementation EARectMealController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    

    
    [self updateUI];
}

-(void)updateUI
{
    
    self.navigationItem.title=@"自由选餐";
    
    self.view.backgroundColor=[UIColor groupTableViewBackgroundColor];
    UICollectionViewFlowLayout *layot=[[UICollectionViewFlowLayout alloc] init];
    layot.itemSize=CGSizeMake(kUI_SCREEN_WIDTH/3-20, kUI_SCREEN_WIDTH/3-20);

    layot.sectionInset=UIEdgeInsetsMake(10, 20, 0, 20);
    
    self.collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(0, 100, kUI_SCREEN_WIDTH, self.view.height-100) collectionViewLayout:layot];
    
    [self.collectionView registerNib:[UINib nibWithNibName:@"EACollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"EACollectionViewCell"];
    
    self.collectionView.dataSource=self;

    [self.view addSubview:self.collectionView];
    
    
    
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"pbl"] style:0 target:self action:@selector(toZhuan)];
    

}



-(void)toZhuan
{

    EARoundMealController * rvc=[[EARoundMealController alloc] init];
    
    [self.navigationController pushViewController:rvc animated:YES];

}





- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section
{
    
    return 10;
    
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

{
    
    EACollectionViewCell * cell=[collectionView  dequeueReusableCellWithReuseIdentifier:@"EACollectionViewCell" forIndexPath:indexPath];
    
    cell.backgroundColor=kWhiteColor;
    
    

    
    
    
    
    return cell;
    
    
    
}
@end
